/**
 * qyPoster - v3.4.0 - 2015-05-141
 *
 *
 * Copyright (c) 2015
 * Licensed MIT <>
 */

function test(a, b, c) {
	audioObj = a, pageContents = b;
	for (var d = 0; d < c.length; d++) {//鏄<span></span><br/>涓�
		var e = c[d].num;
		$('<div class = "praise_warp"></div>')
			.prependTo($("#page" + e))
			.attr("id", "praise_warp" + e)
			.attr("style", "background-image: url(" + c[d].praise.bgImage.path + ");background-size:cover;width:100%; height: 100%;");
		$('<div class="px_statistics"><p class="cn_type2">鎰熻阿鎮�<br/>瑙佽瘉鎴戜滑鐗垫墜</p><a id="page1_go_on" onclick="px_statistics()">缁х画</a></div>')
			.appendTo($("#praise_warp" + e))
			.attr("id", "px_statistics" + e);
		$('<div class="px_top"></div><div class="contentName">娆㈣繋鎮ㄦ潵鍙傚姞鎴戜滑鐨勫绀�</div>')
			.appendTo($("#praise_warp" + e));
		$('<div class="px_slide"></div>')
			.appendTo($("#praise_warp" + e))
			.attr("id", "px_slide" + e);
		$('<div class="person person_boy animate1"></div><div class="person person_girl" style="background-image:url(/static/img/praise_warp/girl.png);"></div><div class="praise_tip" style="bottom:17%;"><div class="hand"></div></div>')
			.appendTo($("#px_slide" + e));
		//console.log(qyPoster, e, b);
		renderPage(qyPoster, e, b);
		unlock(e);
	}
}
function unlock(a) {
	$("#praise_warp" + a).find('.animate1').on(tapstart, function(e) {
		e.preventDefault();
		var x, y, sw, sh;
		sw = document.documentElement.clientWidth;
		sh = document.documentElement.clientHeight;
		x = $(this).offset().left;
		//y = $(this).offset().top;
		$(this).css({
			left: x,
			bottom: 0,
			x: 0,
			// y: 0
		});
		x1 = e.originalEvent.targetTouches[0].pageX;
		//y1 = e.originalEvent.targetTouches[0].pageY;
		w = $(this).width() - 10;
		h = $(this).height();
	}).on(tapmove,function(e){
		e.preventDefault();
		var x2, y2, x3, y3;
		//console.log(e.targetTouches[0]);
		x2 = e.originalEvent.targetTouches[0].pageX;
		//y2 = e.originalEvent.targetTouches[0].pageY;
		//鏈€鏂扮殑浣嶇疆
		x3 = x2 - x1;
		//y3 = y2 - y1;
		//鎷栧姩澶勭悊鏂瑰紡
		$(this).css({
			marginLeft: x3,
		});
		//鍒ゆ柇鏄惁鎽勫悎鎴愬姛
		if ((($(this).offset().left + w) < $(this).next().offset().left) || (($(this).offset().top + h) < $(this).next().offset().top) || ($(this).offset().top > ($(this).next().offset().top + $(this).next().height())) || ($(this).offset().left > ($(this).next().offset().left + $(this).next().width()))) {
		} else {
			var changeSlide=$("#praise_warp" + a);
			changeSlide.find(".animate1").off("touchmove touchstart");
			changeSlide.addClass('p1touched');
			var tips = changeSlide.find('.praise_tip');
			tips[0].style.display = 'none';
			$('.contentName,#px_slide1').fadeOut(3000);
			$('.px_statistics').fadeIn(3000);//css('display','block').animate({width:'200px',height:'200px'});
		}
	});
}
function px_statistics(){
	$("#praise_warp1").fadeOut(2000);
}
var pageContents, andioObj, hastouch = "ontouchstart" in window ? !0 : !1,
	tapstart = hastouch ? "touchstart" : "mousedown",
	tapmove = hastouch ? "touchmove" : "mousemove",
	tapend = hastouch ? "touchend" : "mouseup";
$(".finger_div").on(tapend, function() {});